package com.happy_hao.user.dto;

import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

@Data
public class UpdateUserRequest {

    @NotNull(message = "id不能为空")
    private Long id;

    @Nullable
    @Pattern(regexp = "^(?=.*[a-zA-Z])[a-zA-Z0-9_]{5,20}$", message = "用户名必须是5-20位的字母、数字或下划线且至少包含一个字母")
    private String userName;

    @Nullable
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不合法")
    private String phone;

    @Nullable
    @Pattern(regexp = "^(?![_.-])[a-zA-Z0-9_.+-]+(?<![_.-])@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]{2,}$", message = "邮箱格式不合法")
    private String email;

    @Nullable
    @Pattern(regexp = "^.{1,64}$", message = "昵称长度不能超过64位")
    private String nickname;

    @Nullable
    @Pattern(regexp = "^(男性|女性)$", message = "性别必须是'男性'或'女性'")
    private String gender;

    @Nullable
    @Pattern(regexp = "^.{1,255}$", message = "简介长度不能超过255")
    private String description;

    @Nullable
    private String encryptedPassword;
}
